/*
 * @Author: xiaoyan
 * @Date: 2021-09-15 16:55:42
 * @LastEditors: xiaoyan
 * @LastEditTime: 2021-09-30 11:02:34
 * @Description: 
 * @FilePath: \vue3-ts-demo\src\store\index.ts
 */
import { createStore } from 'vuex'
import { store as app, AppStore, AppState } from '@/store/modules/app'
import { store as user, UserStore, UserState } from '@/store/modules/user'
import { store as tagViews, TagsStore, TagsViewState } from '@/store/modules/tagsview'

export interface RootState {
    app: AppState
    user: UserState
    tagViews: TagsViewState
}

export type Store = AppStore<Pick<RootState, 'app'>> & UserStore<Pick<RootState, 'user'>> & TagsStore<Pick<RootState, 'tagViews'>>

export const store = createStore({
    modules:{
        app,
        user,
        tagViews
    },
})

export function useStore():Store{
    return store as Store
}